function TimedClick($this) {
		var Tim = 60;
		$this.attr("disabled", true).val('重新发送(' + Tim + ')');
		var time = window.setInterval(function() {
			Tim--
			$this.val('重新发送(' + Tim + ')');
			if(Tim <= 0) {
				window.clearInterval(time);
				$this.removeAttr("disabled").val('重新发送');
			}
		}, 1000)
	}


function cartSub($this){
	var id=$this.attr("data-id");
	var num=$this.parents(".add-subtract").find("input#span-num").val();
	if(num<=1){
		num=1
	}else{
		num--
	}
	$this.parents(".add-subtract").find("input#span-num").val(num);
	$.ajax({
		type: 'post',
		dataType: 'json',
		data:{
			id:id,
			number:num
		},
		url: addcartlistSrc,
		success: function(data) {}
	})


}
function cartAdd($this){
	var id=$this.attr("data-id");
	var num=$this.parents(".add-subtract").find("input#span-num").val();
	num++
	$this.parents(".add-subtract").find("input#span-num").val(num);
	$.ajax({
		type: 'post',
		dataType: 'json',
		data:{
			id:id,
			number:num
		},
		url: addcartlistSrc,
		success: function(data) {}
	})
}
function refreshVerify() {
    var ts = Date.parse(new Date())/1000;
    $('#Verify img').attr("src", "/captcha?id="+ts);
}


layui.use(['form', 'layedit', 'laydate'], function() {
	var form = layui.form,
		layer = layui.layer,
		layedit = layui.layedit,
		laydate = layui.laydate;

	//会员等级
	function levelsFun() {
		$.ajax({
			type: 'post',
			dataType: 'json',
			url: mLevels,
			success: function(data) {
				if(data.code != 1) {
					alert("会员等级数据请求失败")
					return false;
				}
				var levelsHtml = '<option value="">请选择会员等级</option>';
				$.each(data.data, function(i, v) {
					levelsHtml += '<option value="' + v.id + '">' + v.level_name + '</option>'
				})
				$("#level_id").html(levelsHtml)
				form.render();
			}

		})
	}

	//会员大区
	function AreaFun() {
		$.ajax({
			type: 'post',
			dataType: 'json',
			url: mArea,
			success: function(data) {
				var areaHtml = '<option value="">请选择大区</option>';
				$.each(data, function(i, v) {
					areaHtml += '<option value="' + i + '">' + v + '</option>'
				})
				$("#area_id").html(areaHtml)
				form.render();
			}

		})
	}

	//会员大区
	function TypeFun() {
		$.ajax({
			type: 'post',
			dataType: 'json',
			url: mType,
			success: function(data) {
				var typeHtml = '<option value="">请选择类型</option>';
				$.each(data, function(i, v) {
					typeHtml += '<option value="' + i + '">' + v + '</option>'
				})
				$("#type_id").html(typeHtml)
				form.render();
			}

		})
	}

	//是否开启代理中心
	function mIsAgentFun() {
		$.ajax({
			type: 'post',
			dataType: 'json',
			url: mIsAgent,
			success: function(data) {
				var IsAgentHtml = '';
				$.each(data, function(i, v) {
					if(i == 2) {
						IsAgentHtml += '<option value="' + i + '" selected>' + v + '</option>'
					} else {
						IsAgentHtml += '<option value="' + i + '">' + v + '</option>'
					}

				})
				$("#is_agent").html(IsAgentHtml)
				form.render();
			}

		})
	}


	//省
	function provFun() {
		$.ajax({
			type: 'post',
			dataType: 'json',
			url: city,
			success: function(data) {
				var provHtml = '<option value="">请选择</option>';
				$.each(data, function(i, v) {
					provHtml += '<option value="' + v.id + '">' + v.name + '</option>'
				})
				$("#prov").html(provHtml)
				form.render();
			}

		})
	}


	//收货地址
	function addressTitleFun() {
		$.ajax({
			type: 'post',
			dataType: 'json',
			url: addressTitleSrc,
			success: function(data) {
				var addressTitleHtml = '<option value="">请选择收货地址</option>';
				$.each(data.data, function(i,v) {
					addressTitleHtml += '<option value="' + v.id + '">' + v.title + '</option>'
				})
				$("#addressTitle").html(addressTitleHtml)
				form.render();
			}

		})
	}

	//银行名称
	function BankFun(){
		$.ajax({
			type: 'post',
			dataType: 'json',
			url:BankLsitSrc,
			success: function(data) {
				var BankLsitHtml = '<option value="">请选择银行</option>';
				$.each(data, function(i,v) {
					BankLsitHtml += '<option value="' + v.id + '">' + v.bank_name + '</option>'
				})
				$("#BankLsit").html(BankLsitHtml)
				form.render();
			}

		})
	}
	//获取会员等级
	function upLevelsFun(){
		$.ajax({
			type: 'post',
			dataType: 'json',
			url:upLevelsSrc,
			success: function(data) {
				var upLevelsHtml = '<option value="">请先选择会员等级</option>';
				$.each(data.data, function(i,v) {
					upLevelsHtml += '<option value="' + v.id + '">' + v.level_name + '</option>'
				})
				$("#up_level_id").html(upLevelsHtml)
				form.render();
			}

		})
	}

	//日期选着器
	laydate.render({
		elem: '#start'
	});
	laydate.render({
		elem: '#end'
	});

	form.verify({
		space: function(value, item) {
			var reg = /(^\s+)|(\s+$)|\s+/g;
			if(reg.test(value) == true) {
				return '请去掉空格！';
			}
		},
		empty: function(value, item) {
			if(value.length < 1) {
				return item.placeholder;
			}
		},
		pass: function(value, item) {
			if(value.length < 6) {
				return '请输入6位数密码';
			}
		},
		safepass: function(value, item) {
			var reg = /^\d{6}$/;
			if(reg.test(value) == false) {
				return '请输入6位纯数字安全密码';
			}
		},
		numb: function(value, item){
			var reg = /^\d+(\.\d+)?$/;
			if(reg.test(value) == false) {
				return '请输入正确的金额';
			}
		}
	});

	//判断当前所在页面执行对应fun************
	var DaId = $("body").attr("data-id");
	switch(DaId) {
		//首页
		case 'home':
			function HomeBonusList() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: HomeBonusListSrc,
					success: function(data) {
						var html = '';

					}
				})
			}
			HomeBonusList();

			break;
			//我得推荐
		case 'TeamMembers':
            layui.use('table', function(){
                var table = layui.table;
                
                var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3,
					success: function() {
						 table.render({
						    elem: '#Table',
						    url: listSrc,
						    response: {
					  			statusCode: 1, //成功的状态码，默认：0
							},
						    cols: [[
						      {field:'id', title: 'ID', width:80,},
						      {field:'mid', title: '编号'},
						      {field:'mname', title: '姓名'},
						      {field:'area_remark', title: '大区'},
						      {field:'type_remark', title: '类型'},
						      {field:'inviter_mid', title: '推荐人'},
						      {field:'seter_mid', title: '安置人',},
						      {field:'agent_mid', title: '所属报单中心'},
						      {field:'level_name', title: '当前等级'},
						      {field:'init_level_name', title: '初始等级'},
						      {field:'floor', title: '层级'},
						      {field:'status_remark', title: '状态'}
						    ]],
						    id: 'testReload',
						    page: true,
						    limit: 20,
						    done:function(){
						    	layer.close(indexLoad)
						    }
						 });
					}
                });
                
                
                var $ = layui.$, active = {
			    reload: function(){
		    	  var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3
		    	  })
			      var mid = $('#mid').val();
			      var start = $('#start').val();
			      var end = $('#end').val();
			      
			      //执行重载
			      table.reload('testReload', {
			        page: {
			          curr: 1 //重新从第 1 页开始
			        },
			        where: {
			          key: {
			            mid: mid,
			            start:start,
			            end:end
			          }
			        },
			        done:function(){
				    	layer.close(indexLoad)
				    }
			      });
			    }
			  };
			  
			  $('.center-search #TeamMembersBnt').on('click', function(){
			    var type = $(this).data('type');
			    active[type] ? active[type].call(this) : '';
			  });
            });

			break;
			//申请报单中心
		case 'TeamApply':
			form.on('submit(Submit)', function(data) {
				var submitLoad = layer.load(1, {
					shade: [0.3, '#000000']
				});
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: data.field,
					url: SubmitSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(submitLoad)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.alert(msg, {
								icon: 5
							})
							layer.close(submitLoad)
						}
					}
				})
			});
			break;

			//申请报单记录
		case 'TeamApplyRecord':
			//记录列表
			function ApplyRecordList() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: '',
					url: listSrc,
					success: function(data) {
						var html = '';
						$.each(data, function(index, value) {
							html += '<tr>';
							html += '<td><div>' + value.title + '</div></td>';
							html += '<td><div>' + value.content + '</div></td>';
							html += '<td><div>' + value.create_time + '</div></td>';
							html += '<td><div>' + value.deal_time + '</div></td>';
							html += '<td><div>' + value.status_remark + '</div></td>';
							html += '</tr>';
						})
						$(".table-cen tbody").html(html);
						$(".paging").html(data.page_html);
						layer.close(indexLoad);
					}
				})
			}
			var indexLoad = layer.load(1, {
				shade: [0.3, '#000000'] //0.1透明度的白色背景
			});
			ApplyRecordList();
			break;

			//申请报单记录
		case 'AgetIndex':
			//记录列表
			
			layui.use('table', function(){
                var table = layui.table;
                
                var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3,
					success: function() {
						 table.render({
						    elem: '#Table',
						    url: listSrc,
						    response: {
					  			statusCode: 1, //成功的状态码，默认：0
							},
						    cols: [[
						      {field:'id', title: 'ID', width:80,},
						      {field:'mid', title: '编号'},
						      {field:'mname', title: '姓名'},
						      {field:'area_remark', title: '大区'},
						      {field:'type_remark', title: '类型'},
						      {field:'inviter_mid', title: '推荐人'},
						      {field:'seter_mid', title: '安置人',},
						      {field:'agent_mid', title: '所属报单中心'},
						      {field:'level_name', title: '当前等级'},
						      {field:'init_level_name', title: '初始等级'},
						      {field:'floor', title: '层级'},
						      {field:'status_remark', title: '状态'}
						    ]],
						    id: 'testReload',
						    page: true,
						    limit: 20,
						    done:function(){
						    	layer.close(indexLoad)
						    }
						 });
					}
                });
                
                
                var $ = layui.$, active = {
			    reload: function(){
		    	  var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3
		    	  })
		    	  var level_id = $("#level_id option:selected").val();
		    	  var status = $("#status option:selected").val();
			      var mid = $('#mid').val();
			      var start = $('#start').val();
			      var end = $('#end').val();
			      
			      //执行重载
			      table.reload('testReload', {
			        page: {
			          curr: 1 //重新从第 1 页开始
			        },
			        where: {
			          key: {
			          	level_id:level_id,
			          	status:status,
			            mid: mid,
			            start:start,
			            end:end
			          }
			        },
			        done:function(){
				    	layer.close(indexLoad)
				    }
			      });
			    }
			  };
			  
			  $('.center-search #AgetIndexBnt').on('click', function(){
			    var type = $(this).data('type');
			    active[type] ? active[type].call(this) : '';
			  });
                
                
            });
			break;

		case 'AgentRegister':

			levelsFun();
			AreaFun();
			TypeFun();
			mIsAgentFun();
			provFun();

			form.on('select(province)', function(data) {
				var id = data.value;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						id: id
					},
					url: city,
					success: function(data) {
						var cityHtml = '<option value="">请选择市</option>';
						var countyHtml = '<option value="">请选择县/区</option>';
						$.each(data, function(i, v) {
							cityHtml += '<option value="' + v.id + '">' + v.name + '</option>'
						})
						$("#city").html(cityHtml)
						$("#county").html(countyHtml)
						form.render();
					}
				})
			});

			form.on('select(city)', function(data) {
				var id = data.value;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						id: id
					},
					url: city,
					success: function(data) {
						var countyHtml = '<option value="">请选择县/区</option>';
						$.each(data, function(i, v) {
							countyHtml += '<option value="' + v.id + '">' + v.name + '</option>'
						})
						$("#county").html(countyHtml)
						form.render();
					}
				})
			});

			form.on('submit(RegisterSubmit)', function(data) {
				var zhi = data.field;

				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: registerSec,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			});
			break;
		case 'accountRecord':
		
		
			layui.use('table', function(){
	            var table = layui.table;
	            
	            var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3,
					success: function() {
						 table.render({
						    elem: '#Table',
						    url: listSrc,
						    response: {
					  			statusCode: 1, //成功的状态码，默认：0
							},
						    cols: [[
						      {field:'id', title: 'ID', width:80,},
						      {field:'operate_remark', title: '类型'},
						      {field:'coin_name', title: '货币'},
						      {field:'amount', title: '金额'},
						      {field:'remark', title: '说明'},
						      {field:'before_amount', title: '交易前'},
						      {field:'after_amount', title: '交易后',},
						      {field:'create_time', title: '时间'},
						    ]],
						    id: 'testReload',
						    page: true,
						    limit: 20,
						    done:function(){
						    	layer.close(indexLoad)
						    }
						 });
					}
                });
	                
	                
	                var $ = layui.$, active = {
				    reload: function(){
			    	  var indexLoad=layer.msg('数据加载中...', {
						icon: 16,
						shade: 0.3
			    	  })
			    	
				      var start = $('#start').val();
				      var end = $('#end').val();
				      
				      //执行重载
				      table.reload('testReload', {
				        page: {
				          curr: 1 //重新从第 1 页开始
				        },
				        where: {
				          key: {
				            start:start,
				            end:end
				          }
				        },
				        done:function(){
					    	layer.close(indexLoad)
					    }
				      });
				    }
				  };
				  
				  $('.center-search #accountRecordBnt').on('click', function(){
				    var type = $(this).data('type');
				    active[type] ? active[type].call(this) : '';
				  });
	                
	                
	            });
		
//			//交易记录
//			function accountRecordList() {
//				$.ajax({
//					type: 'post',
//					dataType: 'json',
//					data: where,
//					url: listSrc,
//					success: function(data) {
//						var html = '';
//						$.each(data.data, function(index, value) {
//							if(value.flag == 'dec') {
//								var amount = '-' + value.amount;
//							} else {
//								var amount = '+' + value.amount;
//							}
//							html +='<tr>';
//							html +='<td><div>' + value.operate_remark + '</div></td>'
//							html +='<td><div>' + value.coin_name + '</div></td>'
//							html +='<td><div>' + amount + '</div></td>'
//							html +='<td><div>' + value.remark + '</div></td>'
//							html +='<td><div>' + value.before_amount + '</div></td>'
//							html +='<td><div>' + value.after_amount + '</div></td>'
//							html +='<td><div>' + value.create_time + '</div></td>'
//							html += '</tr>';
//						});
//						$(".table-cen tbody").html(html);
//						$(".paging").html(data.page_html);
//						layer.close(indexLoad);
//					}
//				})
//			}
//			var indexLoad = layer.load(1, {
//				shade: [0.3, '#000000'] //0.1透明度的白色背景
//			});
//			accountRecordList();
			break;

		case 'bonusIndex':
		
		    layui.use('table', function(){
	            var table = layui.table;
	            
	            var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3,
					success: function() {
						 table.render({
						    elem: '#Table',
						    url: listSrc,
						    response: {
					  			statusCode: 1, //成功的状态码，默认：0
							},
						    cols: [[
						      {field:'id', title: 'ID', width:80,},
						      {field:'bonus_tag', title: '奖金类型'},
						      {field:'coin_name', title: '货币类型'},
						      {field:'amount', title: '奖金金额'},
						      {field:'reason_mid', title: '来源用户'},
						      {field:'remark', title: '奖金说明'},
						      {field:'reason_date', title: '产生时间',},
						      {field:'create_date', title: '结算时间'},
						      {field:'status_remark', title: '状态'}
						    ]],
						    id: 'testReload',
						    page: true,
						    limit: 10,
						    done:function(){
						    	layer.close(indexLoad)
						    }
						 });
					}
                });
	                
	                
	                var $ = layui.$, active = {
				    reload: function(){
			    	  var indexLoad=layer.msg('数据加载中...', {
						icon: 16,
						shade: 0.3
			    	  })
			    	
				      var start = $('#start').val();
				      var end = $('#end').val();
				      
				      //执行重载
				      table.reload('testReload', {
				        page: {
				          curr: 1 //重新从第 1 页开始
				        },
				        where: {
				          key: {
				            start:start,
				            end:end
				          }
				        },
				        done:function(){
					    	layer.close(indexLoad)
					    }
				      });
				    }
				  };
				  
				  $('.center-search #bonusIndexBnt').on('click', function(){
				    var type = $(this).data('type');
				    active[type] ? active[type].call(this) : '';
				  });
	                
	                
	            });
		
			//交易记录
//			function bonusIndexList() {
//				var indexLoad = layer.load(1, {
//				    shade: [0.3, '#000000'] //0.1透明度的白色背景
//		    	});
//				$.ajax({
//					type: 'post',
//					dataType: 'json',
//					data: where,
//					url: listSrc,
//					success: function(data) {
//						var html = '';
//						$.each(data.data,function(index,value){
//							html += '<tr><td><div>'+value.bonus_tag+'</div></td>'
//							html +='<td><div>'+value.coin_name+'</div></td>'
//							html +='<td><div>'+value.amount+'</div></td>'
//							html +='<td><div>'+value.reason_mid+'</div></td>'
//							html +='<td><div>'+value.remark+'</div></td>'
//							html +='<td><div>'+value.reason_date+'</div></td>'
//							html +='<td><div>'+value.create_date+'</div></td>'
//							html +='<td><div>'+value.status_remark+'</div></td>'
//							html +='</tr>';
//						});
//						$(".table-cen tbody").html(html);
//						$(".paging").html(data.page_html);
//						layer.close(indexLoad);
//					}
//				})
//			}
//			bonusIndexList();
			break;


		case 'accountTransfer':
			//可转账货币
			function transferCoinFun() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: trasferCoin,
					success: function(data) {
						var trasferCoinHtml = '<option value="">请选择转账货币</option>';
						$.each(data, function(i, v) {
							trasferCoinHtml += '<option value="' + v.coin_id + '">' + v.coin_name + '</option>'
						})
						$("#trasferCoin").html(trasferCoinHtml)
						form.render();
					}

				})
			}
			transferCoinFun();
			//货币转账
			form.on('submit(TransferSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: transfer,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})


			})
			break;
		case 'accountRecordTransfer':
		    function accountRecordTransferList() {
				var indexLoad = layer.load(1, {
				    shade: [0.3, '#000000'] //0.1透明度的白色背景
		    	});
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: where,
					url: listSrc,
					success: function(data) {
						var html = '';
						$.each(data.data,function(index,value){
							html += '<tr><td><div>'+value.target_mid+'</div></td>'
							html +='<td><div>'+value.coin_name+'</div></td>'
							html +='<td><div>'+value.amount+'</div></td>'
							html +='<td><div>'+value.message+'</div></td>'
							html +='<td><div>'+value.remark+'</div></td>'
							html +='<td><div>'+value.status_remark+'</div></td>'
							html +='<td><div>'+value.create_date+'</div></td>'
							html +='</tr>';
						});
						$(".table-cen tbody").html(html);
						$(".paging").html(data.page_html);
						layer.close(indexLoad);
					}
				})
			}
			accountRecordTransferList();
		    break;
		case 'accountConvert':
			//转账原货币
			function yConvertCoinFun() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: convertCoin,
					success: function(data) {
						var yConvertCoinHtml = '<option value="">请选择原货币</option>';
						$.each(data, function(i, v) {
							yConvertCoinHtml += '<option value="' + v.coin_id + '">' + v.coin_name + '</option>'
						})
						$("#yConvertCoin").html(yConvertCoinHtml)
						form.render();
					}

				})
			}
			//转账目标货币
			form.on('select(convertCoin)', function(data) {
				var coin_id=data.value;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data:{
						coin_id:coin_id
					},
					url: convertCoin,
					success: function(data) {
						var mConvertCoinHtml = '<option value="">请选择目标货币</option>';
						$.each(data.target, function(i, v) {
							mConvertCoinHtml += '<option value="' + v.convert_coin_id + '">' + v.convert_coin_name + '</option>'
						})
						$("#mConvertCoin").html(mConvertCoinHtml)
						form.render();
					}

				})
			})
			yConvertCoinFun();
			//货币转账
			form.on('submit(TransferSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: convert,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})
			break;

	    case 'accountRecordConvert':
	        function accountRecordConvertList() {
				var indexLoad = layer.load(1, {
				    shade: [0.3, '#000000'] //0.1透明度的白色背景
		    	});
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: where,
					url: listSrc,
					success: function(data) {
						var html = '';
						$.each(data.data,function(index,value){
							html += '<tr><td><div>'+value.coin_name+'</div></td>'
							html +='<td><div>'+value.convert_coin_name+'</div></td>'
							html +='<td><div>'+value.amount+'</div></td>'
							html +='<td><div>'+value.remark+'</div></td>'
							html +='<td><div>'+value.status_remark+'</div></td>'
							html +='<td><div>'+value.create_date+'</div></td>'
							html +='</tr>';
						});
						$(".table-cen tbody").html(html);
						$(".paging").html(data.page_html);
						layer.close(indexLoad);
					}
				})
			}
			accountRecordConvertList();
	        break;
		case 'accountCharge':
			//可充值货币
			function accountChargeFun() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: chargeCoin,
					success: function(data) {
						var accountChargeHtml = '<option value="">请选择充值货币</option>';
						$.each(data, function(i, v) {
							accountChargeHtml += '<option value="' + v.coin_id + '">' + v.coin_name + '</option>'
						})
						$("#accountCharge").html(accountChargeHtml)
						form.render();
					}

				})
			}
			accountChargeFun();
			//货币充值
			form.on('submit(ChargeSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: charge,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})


			})
			break;
	    case 'accountRecordCharge':
	         function accountRecordChargeList() {
				var indexLoad = layer.load(1, {
				    shade: [0.3, '#000000'] //0.1透明度的白色背景
		    	});
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: where,
					url: listSrc,
					success: function(data) {
						var html = '';
						$.each(data.data,function(index,value){
							html += '<tr><td><div>'+value.coin_name+'</div></td>'
							html +='<td><div>'+value.amount+'</div></td>'
							html +='<td><div>'+value.bank_name+'</div></td>'
							html +='<td><div>'+value.bank_card+'</div></td>'
							html +='<td><div>'+value.owner+'</div></td>'
							html +='<td><div>'+value.bank_address+'</div></td>'
							html +='<td><div>'+value.operate_date+'</div></td>'
							html +='<td><div>'+value.create_date+'</div></td>'
							html +='<td><div>'+value.status_remark+'</div></td>'
							html +='<td><div>'+value.remark+'</div></td>'
							html +='<td><div>'+value.deal_date+'</div></td>'
							html +='</tr>';
						});
						$(".table-cen tbody").html(html);
						$(".paging").html(data.page_html);
						layer.close(indexLoad);
					}
				})
			}
			accountRecordChargeList();
	        break;
		case 'accountWithdraw':
		    //我得银行卡
			function BankCardFun() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: bankCard,
					success: function(data) {
						var BankCardHtml = '<option value="">请选择银行卡</option>';
						$.each(data.data, function(i, v) {
							
							if(v.default==1){
								BankCardHtml += '<option value="'+v.bank_id+'" selected>'+v.bank_name+'</option>'
							}else{
								BankCardHtml += '<option value="'+v.bank_id+'">'+v.bank_name+'</option>'
							}
						})
						$("#bankCard").html(BankCardHtml)
						form.render();
					}

				})
			}
			BankCardFun();
			//可提现货币
			function accountWithdrawFun() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: withdrawCoin,
					success: function(data) {
						var accountWithdrawHtml = '<option value="">请选择提现货币</option>';
						$.each(data, function(i, v) {
							accountWithdrawHtml += '<option value="' + v.coin_id + '">' + v.coin_name + '</option>'
						})
						$("#accountWithdraw").html(accountWithdrawHtml)
						form.render();
					}

				})
			}
			accountWithdrawFun();
			//可提现金额
			form.on('select(withdrawCoin)', function(data) {
				var coin_id=data.value;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data:{
						id:coin_id
					},
					url: ycoin,
					success: function(data) {
						$("#Available").val(data.amount)
					}

				})
			})


			//货币提现
			form.on('submit(WithdrawSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: withdraw,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})


			})
			break;

		case 'accountRecordWithdraw':
		     function accountRecordWithdrawList() {
				var indexLoad = layer.load(1, {
				    shade: [0.3, '#000000'] //0.1透明度的白色背景
		    	});
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: where,
					url: listSrc,
					success: function(data) {
						var html = '';
						$.each(data.data,function(index,value){
							html += '<tr><td><div>'+value.coin_name+'</div></td>'
							html +='<td><div>'+value.amount+'</div></td>'
							html +='<td><div>'+value.bank_name+'</div></td>'
							html +='<td><div>'+value.bank_card+'</div></td>'
							html +='<td><div>'+value.owner+'</div></td>'
							html +='<td><div>'+value.bank_address+'</div></td>'
							html +='<td><div>'+value.create_date+'</div></td>'
							html +='<td><div>'+value.status_remark+'</div></td>'
							html +='<td><div>'+value.remark+'</div></td>'
							html +='<td><div>'+value.deal_date+'</div></td>'
							html +='</tr>';
						});
						$(".table-cen tbody").html(html);
						$(".paging").html(data.page_html);
						layer.close(indexLoad);
					}
				})
			}
			accountRecordWithdrawList();

		    break;
		case 'goodsIndex':
		   //商品列表
			function GoodsIndexFun(coin_id,cate_id,desc_name) {
				var indexLoad = layer.load(1, {
					shade: [0.3, '#000000'] //0.1透明度的白色背景
				});
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						coin_id:coin_id,
						cate_id:cate_id,
						desc_name:desc_name,
					},
					url: goodsIndexSrc,
					success: function(data) {
						var html = '';
						$.each(data.data, function(index,value) {
							html += '<li><a href="'+goodsDetails+'?id='+value.id+'"><div class="mall-last-xq"><div class="tu"><img src="'+value.photo+'"></div><div class="jg f-orange"><span class="f14">￥</span><span class="f20">'+value.price+'</span></div><div class="bt f14 f-black">'+value.title+'</div><div class="bz f12 f-gray">'+value.coin_name+'</div></div></a></li>';

						});
						$(".mall-last-cen").html(html);
						$(".paging").html(data.page_html);
						layer.close(indexLoad);
					}
				})
			}
			GoodsIndexFun();


			//货币类型
			function goodsCoinTypeFun() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: goodsCoinType,
					success: function(data) {
						$.each(data, function(i,v) {
							if(v.id==seet.coin_id){
								var goodsCoinTypeHtml='<a href="#" data-id="'+v.id+'" class="akt">'+v.coin_name+'</a>'
								$("#aBx").removeClass("akt");
							}else{
								var goodsCoinTypeHtml= '<a href="#" data-id="'+v.id+'">'+v.coin_name+'</a>'
							}
							$("#goodsCoinType").append(goodsCoinTypeHtml)
						})
					}

				})
			}
			goodsCoinTypeFun();

			//商品类型
			function goodsCateTypeFun() {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: goodsCateType,
					success: function(data) {
					    $.each(data, function(i,v) {
							if(v.id==seet.cate_id){
								var goodsCateTypeHtml='<a href="#" data-id="'+v.id+'" class="akt">'+v.title+'</a>'
								$("#aLx").removeClass("akt");
							}else{
								var goodsCateTypeHtml= '<a href="#" data-id="'+v.id+'">'+v.title+'</a>'
							}
							$("#goodsCateType").append(goodsCateTypeHtml)
						})
					}


				})
			}
			goodsCateTypeFun();

			$("#goodsCoinType").on("click","a",function(){
				$(this).addClass("akt").siblings().removeClass("akt");
				var coin_id=$(this).attr("data-id");
				var cate_id=$("#goodsCateType a.akt").attr("data-id");
				var desc_name=$("#goodsPxType li.akt").attr("data-id");
				GoodsIndexFun(coin_id,cate_id,desc_name);
			})
			$("#goodsCateType").on("click","a",function(){
				$(this).addClass("akt").siblings().removeClass("akt");
				var coin_id=$("#goodsCoinType a.akt").attr("data-id");
				var cate_id=$(this).attr("data-id");
				var desc_name=$("#goodsPxType li.akt").attr("data-id");
				GoodsIndexFun(coin_id,cate_id,desc_name);
			})


			$("#goodsPxType li").each(function(i,v){

				if($(this).attr("data")==seet.desc_name){
				     $(this).addClass("akt").siblings().removeClass("akt");
				}
			})


			$("#goodsPxType").on("click","li",function(){
				$(this).addClass("akt").siblings().removeClass("akt");
				var coin_id=$("#goodsCoinType a.akt").attr("data-id");
				var cate_id=$("#goodsCateType a.akt").attr("data-id");
				var desc_name=$(this).attr("data-id");
				GoodsIndexFun(coin_id,cate_id,desc_name);
			})
			break;


		case 'goodsDetails':
			function goodsDetailsFun() {
				var id=$("#gid").val();
				var indexLoad = layer.load(1, {
					shade: [0.3, '#000000'] //0.1透明度的白色背景
				});
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						id:id
					},
					url: goodsDetails,
					success: function(data) {
						$("#xqTitle").html(data.title);
						$("#xqPrice").html(data.price);
						$("#xqScore").html(data.score);
						$("#xqCoinName").html(data.coin_name);
						$("#xqTotal").html(data.total);
						$("#xqUnit").html(data.unit);
						$("#xqSaleNum").html(data.sales_num);
						$("#xqCateName").html(data.cate_name);
						$("#xqCreateTime").html(data.create_time);
						$("#cqContent").html(data.content);
						layer.close(indexLoad);
					}
				})
			}
			goodsDetailsFun();



			$(".jia-jian").on("click","span.jian",function(){
				var num=$(".jia-jian input[type=number]").val();
				if(num<=1){
					num=1
				}else{
					num--
				}
				$(".jia-jian input[type=number]").val(num);
			})

			$(".jia-jian input[type=number]").blur(function(){

				if($(".jia-jian input[type=number]").val()<=1){
					$(".jia-jian input[type=number]").val("1");
				}
			})

			$(".jia-jian").on("click","span.jia",function(){
				var num=$(".jia-jian input[type=number]").val();
					num++
				$(".jia-jian input[type=number]").val(num);


			})



			$(".jrgwc").click(function(){
				var id=$("#gid").val();
				var num=$("#cPnumber").val();

				$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						id:id,
						number:num
					},
					url: addcartSrc,
					success: function(data) {
						layer.msg(data.msg)
					}
				})
			});
			$(".ljgm").click(function(){
				var id=$("#gid").val();
				var num=$("#cPnumber").val();

				$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						id:id,
						number:num
					},
					url: addcartSrc,
					success: function(data) {
						window.location.href='/home/cart.show/index'
					}
				})
			});
			break;



			case 'cartIndex':
			addressTitleFun();
		   //购物车列表
			function cartIndexFun() {
				var indexLoad = layer.load(1, {
					shade: [0.3, '#000000'] //0.1透明度的白色背景
				});
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: cartSrc,
					success: function(data) {
						var html = '';
						$.each(data.data, function(i,v) {
							html += '<tr>';
							html += '<td><div class="mall-tp"><img src="'+v.goods.photo+'"></div></td>';
							html += '<td><div>'+v.goods.title+'</div></td>';
							html += '<td><div>默认</div></td>';
							html += '<td><div>默认</div></td>';
							html += '<td><div>'+v.price+'</div></td>';
							html += '<td><div><div class="add-subtract"><span class="sub f26" data-id="'+v.id+'" onclick="cartSub($(this))">-</span><input type="number" id="span-num" value="'+v.number+'"><span class="add f26" data-id="'+v.id+'" onclick="cartAdd($(this))">+</span></div></div></td>';
							html += '<td><div>'+v.goods.coin_name+'</div></td>';
							html += '<td><div>'+v.credit+'</div></td>';
							html += '<td><div><a href="#">删除</a></div></td>';
							html += '</tr>';

						});
						$(".table-cen tbody").html(html);
						layer.close(indexLoad);
					}
				})
			}
			cartIndexFun();




			form.on('submit(cartIndexSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: getOrderSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								window.location.href='/home/order.show/index'
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})


			})

			break;
        
        case 'orderIndex':
            layui.use('table', function(){
	            var table = layui.table;
	            var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3,
					success: function() {
						 table.render({
						    elem: '#Table',
						    url: orderSrc,
						    response: {
					  			statusCode: 1, //成功的状态码，默认：0
							},
						    cols: [[
						      {field:'id', title: 'ID', width:80,},
						      {field:'order_id', title: '订单号'},
						      {field:'des', title: '订单详情',width:500,},
						      {field:'amount', title: '金额'},
						      {field:'create_time', title: '时间'},
						      {field:'chs_status', title: '状态'}
						    ]],
						    id: 'testReload',
						    page: true,
						    limit: 10,
						    done:function(){
						    	layer.close(indexLoad)
						    }
						 });
					}
                });
	                
	                
	                var $ = layui.$, active = {
				    reload: function(){
			    	  var indexLoad=layer.msg('数据加载中...', {
						icon: 16,
						shade: 0.3
			    	  })
			    	
				      var start = $('#start').val();
				      var end = $('#end').val();
				      
				      //执行重载
				      table.reload('testReload', {
				        page: {
				          curr: 1 //重新从第 1 页开始
				        },
				        where: {
				          key: {
				            start:start,
				            end:end
				          }
				        },
				        done:function(){
					    	layer.close(indexLoad)
					    }
				      });
				    }
				  };
				  
				  $('.center-search #orderIndexBnt').on('click', function(){
				    var type = $(this).data('type');
				    active[type] ? active[type].call(this) : '';
				  });
	                
	                
	            });
            
            
            break
		case 'addressIndex':
			provFun();
			form.on('select(province)', function(data) {
				var id = data.value;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						id: id
					},
					url: city,
					success: function(data) {
						var cityHtml = '<option value="">请选择市</option>';
						var countyHtml = '<option value="">请选择县/区</option>';
						$.each(data, function(i, v) {
							cityHtml += '<option value="' + v.id + '">' + v.name + '</option>'
						})
						$("#city").html(cityHtml)
						$("#county").html(countyHtml)
						form.render();
					}
				})
			});

			form.on('select(city)', function(data) {
				var id = data.value;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						id: id
					},
					url: city,
					success: function(data) {
						var countyHtml = '<option value="">请选择县/区</option>';
						$.each(data, function(i, v) {
							countyHtml += '<option value="' + v.id + '">' + v.name + '</option>'
						})
						$("#county").html(countyHtml)
						form.render();
					}
				})
			});

			form.on('submit(addressSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: addressSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})


			})
			
			
			
			layui.use('table', function(){
	            var table = layui.table,form = layui.form;
	            
	            var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3,
					success: function() {
						$.ajax({
							type: 'post',
							url: addressListSrc,
							dataType: 'json',
							success: function(data) {
								table.render({
								    elem: '#Table',
								    cols: [[
								      {field:'id', title: 'ID', width:60},
								      {field:'title', title: '名称', width:100},
								      {field:'uname', title: '姓名', width:100},
								      {field:'mphone', title: '手机号码', width:250},
								      {field:'address', title: '地址',width:500},
								      {field:'default', title: '操作',templet: '#barDemo'}
								    ]],
								    data:data.data,
								    done:function(){
								    	layer.close(indexLoad)
								    }
								});
							}
						})
					}
                });
                
                
                //监听锁定操作
				form.on('checkbox(defaultDemo)', function(obj){
					var id=this.value;
					var token=this.name;
	  	            var tf=obj.elem.checked;
					if(tf==true){ 
				    	var Default='1';
				    	var Cen='您确定设为默认地址！';
				    }else{
				    	var Default='0'
				    	var Cen='您确定取消默认地址！';
				    }
				    layer.confirm(Cen, {
						  btn: ['确定','取消'] //按钮
						}, function(){
						     $.ajax({
								type: 'post',
								dataType: 'json',
								url:setDefault,
								data: {
									id:id,
									token:token
								},
								success: function(data) {
									var code = data.code;
									var msg = data.msg;
									if(code == 1) {
										layer.close(layer.index)
										layer.alert(msg, {
											icon: 1
										})
									} else {
										layer.alert(msg, {
											icon: 5
										},function(){
											location.reload();
										})
									}
								}
							})
						}, function(){
						 location.reload();
						});
			    	}); 
	            });
			
			
			
			
			break;
		case "bankIndex":
		    BankFun();
		    form.on('submit(bankIndexSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: addBank,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})
		    
		    
		    layui.use('table', function(){
	            var table = layui.table,form = layui.form;
	            
	            var indexLoad=layer.msg('数据加载中...', {
					icon: 16,
					shade: 0.3,
					success: function() {
						$.ajax({
							type: 'post',
							url: BankCard,
							dataType: 'json',
							success: function(data) {
								table.render({
								    elem: '#Table',
								    cols: [[
								      {field:'id', title: 'ID', width:60},
								      {field:'bank_name', title: '银行名称', width:100},
								      {field:'owner', title: '持卡人', width:100},
								      {field:'bank_card', title: '银行卡号', width:250},
								      {field:'bank_address', title: '开户地址',width:500},
								      {field:'default', title: '操作',templet: '#barDemo'}
								    ]],
								    data:data.data,
								    done:function(){
								    	layer.close(indexLoad)
								    }
								});
							}
						})
					}
                });
                
                
                //监听锁定操作
				form.on('checkbox(defaultDemo)', function(obj){
					var id=this.value;
					var token=this.name;
	  	            var tf=obj.elem.checked;
					if(tf==true){ 
				    	var Default='1';
				    	var Cen='您确定设为默认地址！';
				    }else{
				    	var Default='0'
				    	var Cen='您确定取消默认地址！';
				    }
				    layer.confirm(Cen, {
						  btn: ['确定','取消'] //按钮
						}, function(){
						     $.ajax({
								type: 'post',
								dataType: 'json',
								url:BankSetDefault,
								data: {
									id:id,
									token:token
								},
								success: function(data) {
									var code = data.code;
									var msg = data.msg;
									if(code == 1) {
										layer.close(layer.index)
										layer.alert(msg, {
											icon: 1
										})
									} else {
										layer.alert(msg, {
											icon: 5
										},function(){
											location.reload();
										})
									}
								}
							})
						}, function(){
						 location.reload();
						});
			    	}); 
	            });
		    
		    
		    

		    break;
		case "userPhone":
		    $("#userPhoneSend").click(function(){
		    	var phone=$("#IdUserPhone").val();
		    	var token=$("#token").val();
		    	if(phone==""){
		    		layer.alert("请输入手机号码", {
						icon: 5
					})
		    		return false;
		    	}
		    	TimedClick($(this));
		    	$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						phone:phone,
						token:token
					},
					url: sendSmscodeSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})

		    })

		    form.on('submit(userPhoneSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: bindPhoneSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})
		    break;
		case "userPhoneChange":
		     var token=$("#token").val();

		     var formHtml='<form class="layui-form"><input type="hidden" id="token" value="'+token+'" name="token"><ul class="center-from-ul clearfix"><li class="width6"><div class="layui-form-item"><label class="layui-form-label">新手机号码</label><div class="layui-input-block"><input type="text" id="IdUserPhone" name="phone" autocomplete="off" class="layui-input"></div></div></li><li><div class="layui-form-item"><label class="layui-form-label">短信验证码</label><div class="layui-input-inline"><input type="text" name="smscode" autocomplete="off" placeholder="请输入短信验证码" class="layui-input"></div><div class="layui-input-inline" style="width: 120px;"><input type="button" autocomplete="off" value="获取验证码" id="userPhoneSend1" class="layui-btn layui-bg-orange"></div></div></li></ul><p class="center-from-p"><input type="button" lay-submit="submit" lay-filter="CxUserPhoneChangeSubmit" class="layui-btn layui-bg-orange" value="重新绑定"></p></form>'



		      $("#userPhoneSend").click(function(){
			    	TimedClick($(this));
			    	$.ajax({
						type: 'post',
						dataType: 'json',
						data: {
							token:token
						},
						url: sendSmscodeSrc,
						success: function(data) {
							var code = data.code;
							var msg = data.msg;
							if(code == 1) {
								layer.close(layer.index)
								layer.alert(msg, {
									icon: 1
								})
							} else {
								layer.close(layer.index)
								layer.alert(msg, {
									icon: 5
								})
							}

						}
					})
			    })



		       $(".center-from").on("click","#userPhoneSend1",function(){

		       	var phone=$("#IdUserPhone").val();
			    	var token=$("#token").val();
			    	TimedClick($(this));
			    	$.ajax({
						type: 'post',
						dataType: 'json',
						data: {
							phone:phone,
							token:token
						},
						url: sendSmscodeSrc1,
						success: function(data) {
							var code = data.code;
							var msg = data.msg;
							if(code == 1) {
								layer.close(layer.index)
								layer.alert(msg, {
									icon: 1
								})
							} else {
								layer.close(layer.index)
								layer.alert(msg, {
									icon: 5
								})
							}

						}
					})

		       })

		     form.on('submit(userPhoneChangeSubmit)', function(data){
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: checkSmscodeSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								layer.close(layer.index)
								$(".center-from").html(formHtml);
								form.render();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})


		     form.on('submit(CxUserPhoneChangeSubmit)', function(data){
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: cbindPhoneSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})

		    break;
		case "userUpgrade":
		    upLevelsFun();
		    $("#userUpgradeSend").click(function(){
		    	var token=$("#token").val();
		    	TimedClick($(this));
		    	$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						token:token
					},
					url: sendSmscodeSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})

		    })

		    form.on('submit(userUpgradeSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: upgradeSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.reload();
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})
		    break;

		case "userPasswd":
		    $("#userUpgradeSend").click(function(){
		    	var token=$("#token").val();
		    	TimedClick($(this));
		    	$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						token:token
					},
					url: sendSmscodeSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})

		    })
		    form.on('submit(userPasswdSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: changePwdSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.href=data.url;
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})
		    break;
		case "userSafePasswd":
		    $("#userUpgradeSend").click(function(){
		    	var token=$("#token").val();
		    	TimedClick($(this));
		    	$.ajax({
					type: 'post',
					dataType: 'json',
					data: {
						token:token
					},
					url: sendSmscodeSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})

		    })
		    form.on('submit(userSafePasswdSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: changeSafePwdSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.href=data.url;
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})
		    break;
		case "userMailSend":
		    form.on('submit(userMailSendSubmit)', function(data) {
				var zhi = data.field;
				$.ajax({
					type: 'post',
					dataType: 'json',
					data: zhi,
					url: mailSendSrc,
					success: function(data) {
						var code = data.code;
						var msg = data.msg;
						if(code == 1) {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 1
							}, function() {
								location.href=data.url;
							})
						} else {
							layer.close(layer.index)
							layer.alert(msg, {
								icon: 5
							})
						}

					}
				})
			})
		    break;


	}

})